"""
Development Configuration
========================

Development environment specific configuration settings.
"""

from . import DevelopmentConfig

class Config(DevelopmentConfig):
    """Development configuration class."""
    
    # Enable debug mode for development
    DEBUG = True
    
    # Database settings for development
    MYSQL_DATABASE = 'flask_enterprise_dev'
    
    # Update database URI for development
    SQLALCHEMY_DATABASE_URI = (
        f"mysql+pymysql://{DevelopmentConfig.MYSQL_USERNAME}:{DevelopmentConfig.MYSQL_PASSWORD}"
        f"@{DevelopmentConfig.MYSQL_HOST}:{DevelopmentConfig.MYSQL_PORT}/{MYSQL_DATABASE}"
    )
    
    # Development-specific overrides
    JWT_ACCESS_TOKEN_EXPIRES = timedelta(hours=8)  # Shorter token expiry for development
    
    # CORS settings for development (more permissive)
    CORS_ORIGINS = ['http://localhost:3000', 'http://127.0.0.1:3000']
    
    # Logging configuration
    LOGGING_CONFIG = {
        'version': 1,
        'disable_existing_loggers': False,
        'formatters': {
            'default': {
                'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s',
            }
        },
        'handlers': {
            'console': {
                'class': 'logging.StreamHandler',
                'stream': 'ext://sys.stdout',
                'formatter': 'default'
            },
            'file': {
                'class': 'logging.handlers.RotatingFileHandler',
                'filename': 'logs/development.log',
                'maxBytes': 10485760,  # 10MB
                'backupCount': 5,
                'formatter': 'default'
            }
        },
        'root': {
            'level': 'DEBUG',
            'handlers': ['console', 'file']
        }
    }